package ruanjian.dao;

import org.apache.ibatis.annotations.*;
import ruanjian.domain.Customer;

import java.util.List;

/**
 * Customer接口
 */
public interface CustomerDao {
    // 客户列表
	@Select("select * from sys_customer")
	public List<Customer> selectCustomerList();
	//客户信息来源
	// 创建客户
	@Insert("insert into sys_customer(cust_name,cust_source,cust_industry,cust_level,cust_mobile,cust_phone)"+
	"values(#{cust_name},#{cust_source},#{cust_industry},#{cust_level},#{cust_mobile},#{cust_phone})")
	public int createCustomer(Customer customer);
	// 通过id查询客户
	@Select("select * from sys_customer where cust_id= #{id}")
	public Customer getCustomerById(Integer id);
	// 更新客户信息
	@Update("update sys_customer set cust_name=#{cust_name},cust_source=#{cust_source},cust_industry=#{cust_industry}," +
			"cust_level=#{cust_level},cust_mobile=#{cust_mobile},cust_phone=#{cust_phone} where cust_id=#{cust_id}")
	public int updateCustomer(Customer customer);
	// 删除客户
	@Delete("delete from sys_customer where cust_id=#{id}")
	int deleteCustomer(Integer id);


}
